﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <meta content="yes" name="apple-mobile-web-app-capable">
    <meta content="black" name="apple-mobile-web-app-status-bar-style">
    <meta content="telephone=no" name="format-detection" />
    <title>填写资料</title>
    <link href="css/style.css" rel="stylesheet" type="text/css" />
    <script src="js/jquery-1.8.3.min.js" type="text/javascript"></script>
    <script src="js/area.js?r=20160902" type="text/javascript"></script>
    <link rel="stylesheet" type="text/css" href="css/mdialog.css">
    <script type="text/javascript" src="js/zepto.min.js"></script>
    <script type="text/javascript" src="js/mdialog.js"></script>
    <script src="js/Script.js" type="text/javascript"></script>
    <style>
        .body
        {
            background: #222657;
            overflow-x: hidden;
        }
        .bg-img
        {
            width: 100%;
            height: 100%;
            position: absolute;
            padding: 0px;
            margin: 0px;
            top: 0px;
            left: 0px;
        }
    </style>
    <script>
        var openid = $.getUrlParam('openid');
        var pid = $.getUrlParam('pid');
        $(function () {
            $(".next-step").live("click", function () {
                if ($.trim($("#txtname").val()) == "") {
                    new TipBox({ type: 'tip', str: '请输入名称！', clickDomCancel: true, setTime: 10000500, hasBtn: true });
                    return;
                }
                if ($.trim($("#txtphone").val()) == "") {
                    new TipBox({ type: 'tip', str: '请输入电话！', clickDomCancel: true, setTime: 10000500, hasBtn: true });
                    return;
                }
                if ($.trim($("#s_province").val()) == "省份") {
                    new TipBox({ type: 'tip', str: '请选择省份！', clickDomCancel: true, setTime: 10000500, hasBtn: true });
                    return;
                }
                if ($.trim($("#s_city").val()) == "城市") {
                    new TipBox({ type: 'tip', str: '请选择城市！', clickDomCancel: true, setTime: 10000500, hasBtn: true });
                    return;
                }
                if ($.trim($("#txtaddrr").val()) == "") {
                    new TipBox({ type: 'tip', str: '请输入地址！', clickDomCancel: true, setTime: 10000500, hasBtn: true });
                    return;
                }
                new TipBox({ type: 'load', str: "提交数据中...", setTime: 1500, callBack: function () {
                    $.ajax({
                        url: url_path + "/AjaxContrls/UnitControler.aspx",
                        type: "POST",
                        data: { aciton: 'saveorder', openid: openid, pid: pid, username: $.trim($("#txtname").val()),
                            phone: $.trim($("#txtphone").val()), bigarea: $.trim($("#s_province").val()), city: $.trim($("#s_city").val()),
                            address: $.trim($("#txtaddrr").val())
                        },
                        timeout: 30000,
                        dataType: "json",
                        success: function (data) {
                            if (data.status == 0) {
                                new TipBox({ type: 'success', str: '操作成功', setTime: 2000, callBack: function () {
                                    window.location.href = 'http://mp.weixin.qq.com/s?__biz=MzIwMTA1NjEzOQ==&mid=2651136492&idx=1&sn=b4841f8e0c4a583586bf57d4d97d2ca6&scene=0#wechat_redirect';
                                } 
                                });
                            } else {
                                alert("操作失败！");
                            }
                        },
                        error: function () {
                        }
                    });
                } 
                });

            });
        });
    </script>
</head>
<body>
    <img class="bg-img" src="img/lottery/抽奖-OK-16.png" />
    <section class='container'>
	<form>
		<fieldset class='alpha'>
			<legend>填写资料领奖</legend>
			<div class='frow'>
            <input class='item' id="txtname" placeholder='请填写收货人姓名' type='text'/>
            </div>
			<div class='frow'>
            <input class='item' id="txtphone" placeholder='请输入手机号码' type='text'/>
            </div>
			<div class='frow'>
            <select id="s_province" name="s_province" data-role='none' class="sele">
                        <option>省份</option>
                    </select>
                    <select id="s_city" name="s_city" data-role='none' class="sele">
                        <option>城市</option>
                    </select>
                    <div id="show">
                </div>
                 
            </div>
            <div class='frow'>
                <textarea rows="3" cols="1" id="txtaddrr" name="txtaddrr" placeholder='请填写详细街道地址'></textarea>
            </div>
			<div class='frow'><a class='next-step' href='#'>提交</a></div>
		</fieldset>
	</form>
</section>
    <script type="text/javascript">
        var Gid = document.getElementById;
        var showArea = function () {
            Gid('show').innerHTML = "<h3>省" + Gid('s_province').value +
                     " - 市" + Gid('s_city').value + "</h3>"
            Gid('s_city').setAttribute('onchange', 'showArea()');
        }
        $(function myfunction() {
            //初始化收货地区
            _init_area();
        });
    </script>
</body>
</html>
